package com.lzhsite.technology.designPattern.visitor.DepartmentDemo;

import java.util.ArrayList;
import java.util.List;

public class ObjectStructure
{
    private List<Corporation> corporations = new ArrayList<Corporation>();

    public void addVisitor(Corporation corporation)
    {
        corporations.add(corporation);
    }

    public void removeVisitor(Corporation corporation)
    {
        corporations.remove(corporation);
    }

    public void accept(Visitor visitor)
    {
        for (Corporation corporation : corporations)
        {
            corporation.accept(visitor);
        }
    }
}
